#pragma once
// -------------------------------------------------
// ZED Kit
// -------------------------------------------------
//   File Name: stack.hpp
//      Author: Ziming Li
//     Created: 2023-11-01
// -------------------------------------------------
// Copyright (C) 2023 MingYang Software Technology.
// -------------------------------------------------

#ifndef ZED_STACK_HPP
#define ZED_STACK_HPP

#include <stack>

namespace zed {

template <typename T, class Container>
class stack
{
public:
    using stack_type = std::stack<T, Container>;
    explicit constexpr stack(stack_type& s) : m_std(s) {}

    [[nodiscard]] typename stack_type::value_type pop(void)
    {
        typename stack_type::value_type ret;
        std::swap(ret, m_std.top());
        m_std.pop();
        return ret;
    }
private:
    stack_type& m_std;
};

template <typename T, class Container>
stack<T, Container> wrap(std::stack<T, Container>& s) { return stack<T, Container>(s); }

} // namespace zed

#endif // ZED_STACK_HPP
